import request from '@/utils/request'

export function reqGetRoleList(page, pagesize = 6) {
  return request({
    method: 'get',
    url: '/sys/role',
    params: {
      page,
      pagesize
    }
  })
}

export function reqDeleteRole(id) {
  return request({
    method: 'delete',
    url: `/sys/role/${id}`
  })
}

export function reqAddRole(data) {
  return request({
    url: '/sys/role',
    data,
    method: 'post'
  })
}

export function reqGetRoleDetail(id) {
  return request({
    url: '/sys/role/' + id
  })
}

export function reqUpdaRole(id) {
  return request({
    method: 'put',
    url: '/sys/role/' + id
  })
}

// 给角色分配权限
export function reqAssignPerm(data) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
